<?php

class Yapary_Webservice_Amazon_Price {

	private $arrData;


	public function __construct(array $_arrData) {
		$this->arrData	= $_arrData;
	}


	public function getPrice () { // Preis inklusive Waehrung
		$priceValue	= ($this->getPriceValue() === NULL) ? '' : $this->getPriceValue();
		return (isset($this->arrData['FormattedPrice'])) ? $this->getCurrency().$priceValue : NULL;
	}


	public function getPriceValue () {
		if (!isset($this->arrData['Amount'])) {
			return NULL;
		}
		$price	= $this->arrData['Amount'];
		return  number_format(($price/100) + 0.00, 2);
	}


	public function getCurrency () {
		if (!isset($this->arrData['CurrencyCode'])) {
			return NULL;
		}

		switch ($this->arrData['CurrencyCode']) {
			case 'GBP':
				return '&pound;';
			case 'EUR':
				return '&euro;';
		}

		return $this->arrData['CurrencyCode'];
	}


	public function getCurrencyName () {
		return (isset($this->arrData['CurrencyCode'])) ? $this->arrData['CurrencyCode'] : NULL;
	}


}

?>